const fs=require('fs')
const path=require('path')
const logpath=path.join(__dirname,'../','log','steam.log')
const moment=require('moment')
const logger = function(){
    return async(ctx,next)=>{
        console.log(ctx,'ctx');
        let requestTime=moment(new Date()).format('YYY-MM-DD h:mm:ss a')
        let appendData=ctx.request.url+'  '+requestTime
        fs.appendFileSync(logpath,appendData,'utf-8')
        await next()  
    }
}


module.exports=logger